export function selectOnFocus(node: HTMLInputElement) {
    if (node && typeof node.select === "function") {
        const onFocus = () => node.select();
        node.addEventListener("focus", onFocus);
        return {
            destroy() {
                node.removeEventListener("focus", onFocus);
            },
        };
    }
}

export function focusOnInit(node) {
    if (node && typeof node.focus === 'function') {
        node.focus()
    }
}